package com.sls.game.service;

import com.sls.core.socket.Head;
import com.sls.core.socket.ServerDisponseException;
import com.sls.game.pojo.DeductionRefundInfo;
import com.sls.game.pojo.GoodsOrderInfo;
import com.sls.game.pojo.GoodsSupplyManageInfo;
import com.sls.game.pojo.SLSHttpInterfaceInfo;

/**
 * @description 交易入口service
 * @author JLM
 * @date 2013-06-20
 * */
public interface EKHInterfaceService {
	/***
	 * @description 交易服务主入口
	 * @param body
	 * @param head
	 * @return
	 * @throws ServerDisponseException
	 * */
	public String insertOfTrading(String body, Head head)
			throws ServerDisponseException;

	/**
	 * @description 交易前校验：包含用户信息校验，用户IP校验等
	 * 
	 * @param head
	 *            消息头
	 * @param info
	 *            下游用户信息
	 * @return
	 * @throws ServerDisponseException
	 * */
	public String beforeTrade(SLSHttpInterfaceInfo info, Head head)
			throws ServerDisponseException;;

	/**
	 * @description 获取商品供应信息：对商品供货信息进行筛选，对下游订单进行金额进行校验
	 * 
	 * @param head
	 *            消息头
	 * @param info
	 *            下游用户信息
     * @param orderid 订单id号（主备切换用于） 对原订单内的供货商进行过滤
	 * @return 返回供应信息
	 * @throws ServerDisponseException
	 * */
	public GoodsSupplyManageInfo selectSupplyInfo(SLSHttpInterfaceInfo info,
			Head head,String... orderid )throws ServerDisponseException;
	/**
	*@description 校验重复单并插入订单：下游订单重复提交校验，订单插入等
	*@param info 下游用户信息
	*@param goodsSupplyManageInfo 供货信息
	*@param head 消息头
	*@param merchantIP ip地址
	*@param orderId 订单编号
	*@param orderTime 订单时间
	*@return
	 * @throws ServerDisponseException
	* */
	public void checkAndInsertGoodsOrder(
			SLSHttpInterfaceInfo info,
			GoodsSupplyManageInfo goodsSupplyManageInfo,
			Head head,String orderId,String orderTime,String  merchantIP)	
			throws ServerDisponseException;
	
	
	/***
	* @description 信任支付 ： 进行支付交易，支付完成之后，更新订单信息
	*@param info 下游用户信息
	*@param orderId 订单编号
	*@param orderTime 订单时间
	*@param head 消息头
	*@return
	* @throws ServerDisponseException
	 * */
	public DeductionRefundInfo trustPay(
			SLSHttpInterfaceInfo info,
			Head head,String orderId,String orderTime)
					throws  ServerDisponseException;
	
	
	/**
	 *  发起供货请求
	*@param info 下游用户信息
	*@param goodsinfo 供货信息
	*@param head 消息头
	*@param orderInfo 订单相关信息
	*@return
	* @throws ServerDisponseException
	 * */
	public SLSHttpInterfaceInfo insertTradeSupply(
			SLSHttpInterfaceInfo requestInfo,
			GoodsOrderInfo orderInfo, Head head, GoodsSupplyManageInfo goodsinfo)
					throws  ServerDisponseException;
}
